home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / UTIL / SCREEN / CURSES01 / minix / c / lineins < prev    next >
Text File  |  1991-05-05  |  3KB  |  90 lines

  1. /****************************************************************/
  2. /* Winsertln() routine of the PCcurses package            */
  3. /*                                */
  4. /****************************************************************/
  5. /* This version of curses is based on ncurses, a curses version    */
  6. /* originally written by Pavel Curtis at Cornell University.    */
  7. /* I have made substantial changes to make it run on IBM PC's,    */
  8. /* and therefore consider myself free to make it public domain.    */
  9. /*        Bjorn Larsson (...mcvax!enea!infovax!bl)    */
  10. /****************************************************************/
  11. /* 1.0:    Release:                    870515    */
  12. /****************************************************************/
  13. /* Modified to run under the MINIX operating system by Don Cope */
  14. /* These changes are also released into the public domain.      */
  15. /*                             900906  */
  16. /****************************************************************/
  17.  
  18. #include <curses.h>
  19. #include "curspriv.h"
  20.  
  21. /****************************************************************/
  22. /* Winsertln() inserts a blank line instead of the cursor line    */
  23. /* in window 'win' and pushes other lines down.            */
  24. /****************************************************************/
  25.  
  26. int    winsertln(win)
  27.   WINDOW    *win;
  28.   {
  29.   int        *temp;
  30.   int        *end;
  31.   short     y;
  32.   static   int     blank;
  33.   
  34.   blank = ' ' | (win->_attrs & ATR_MSK);
  35.   temp = win->_line[win->_regbottom];
  36.   for (y = win->_regbottom;  y > win->_cury;  y--)
  37.     {
  38.     win->_line[y] = win->_line[y-1];
  39.     win->_minchng[y] = 0;
  40.     win->_maxchng[y] = win->_maxx;
  41.     } /* for */
  42.   win->_line[win->_cury] = temp;
  43.   for (end = &temp[win->_maxx];  temp <= end;  temp++)
  44.     *temp = blank;
  45.   win->_minchng[win->_cury] = 0;
  46.   win->_maxchng[win->_cury] = win->_maxx;
  47.   return(OK);
  48.   } /* winsertln */
  49.  
  50. /****************************************************************/
  51. /* Insertln() inserts a blank line instead of the cursor line    */
  52. /* in stdscr and pushes other lines down.            */
  53. /****************************************************************/
  54.  
  55. int insertln()
  56.   {
  57.   return(winsertln(stdscr));
  58.   } /* insertln */
  59.  
  60. /****************************************************************/
  61. /* Mvinsertln() moves the stdscr cursor to a new positions, in-    */
  62. /* serts a blank line instead of the cursor line and pushes    */
  63. /* other lines down.                        */
  64. /****************************************************************/
  65.  
  66. int mvinsert(y,x)
  67.   int y;
  68.   int x;
  69.   {
  70.   if (wmove(stdscr,y,x) == ERR)
  71.     return(ERR);
  72.   return(winsertln(stdscr));
  73.   } /* mvinsert */
  74.  
  75. /****************************************************************/
  76. /* Mvinsertln() moves the cursor in window 'win' to a new posi-    */
  77. /* tions, inserts a blank line instead of the cursor line and    */
  78. /* pushes other lines down.                    */
  79. /****************************************************************/
  80.  
  81. int mvwinsert(win,y,x)
  82.   WINDOW *win;
  83.   int y;
  84.   int x;
  85.   {
  86.   if (wmove(win,y,x) == ERR)
  87.     return(ERR);
  88.   return(winsertln(win));
  89.   } /* mvwinsert */
  90.